package com.atguigu.gmall.common.result;

import lombok.Getter;

/**
 * 统一返回结果状态信息类
 *
 */
@Getter
public enum ResultCodeEnum {

    SUCCESS(200,"成功"),
    FAIL(201, "失败"),
    SERVICE_ERROR(500, "服务异常"),

    PAY_RUN(205, "支付中"),



    LOGIN_AUTH(208, "未登陆"),
    PERMISSION(209, "没有权限"),
    SECKILL_NO_START(210, "秒杀还没开始"),
    SECKILL_RUN(211, "正在排队中"),
    SECKILL_NO_PAY_ORDER(212, "您有未支付的订单"),
    SECKILL_FINISH(213, "已售罄"),
    SECKILL_END(214, "秒杀已结束"),
    SECKILL_SUCCESS(215, "抢单成功"),
    SECKILL_FAIL(216, "抢单失败"),
    SECKILL_ILLEGAL(217, "请求不合法"),
    SECKILL_ORDER_SUCCESS(218, "下单成功"),
    COUPON_GET(220, "优惠券已经领取"),
    COUPON_LIMIT_GET(221, "优惠券已发放完毕"),

    //以 4xxx 开头的都是客户端错误
    VALIDATED_FAILED(40001,"校验失败"),
    REPEAT_REQUEST(40002,"请勿重复提交"),

    //以 5xxx 的都是服务器错误


    //以2开头的都是  商品服务有关的错误
    SKU_HAS_EXIST(20001,"商品已经存在，请勿重复录入"),
    SKU_NO_STOCK(20002,"没有库存"),
    SKU_PRICE_CHANGE(20003,"价格变化"),


    //以后3xxx都是 用户服务有关的错误
    LOGIN_FAILED_ACCOUNT_PWD_ERROR(30001,"账号或密码错误"),
    CART_ITEM_OVERFLOW(60001, "购物车单个商品最多购买100件"),
    CART_SIZE_OVERFLOW(60002, "购物车商品不得超过100种");

    private Integer code;

    private String message;

    private ResultCodeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
}
